import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import Components from 'unplugin-vue-components/vite';
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';

// https://vite.dev/config/
export default defineConfig({
  base: './',
  plugins: [
      vue(),
    Components({
      dts: 'src/typings/components.d.ts',
      resolvers: [
        NaiveUiResolver()
      ]
    })
  ],
  resolve: {
    alias: {
      // 指向组件库源码而非 dist 目录
      'hl-table-render': path.resolve(__dirname, '../src'),
      'vue': path.resolve(__dirname, 'node_modules/vue') // 确保使用正确的 Vue
    }
  },
  optimizeDeps: {
    include: ['hl-table-render'] // 强制 Vite 优化依赖
  }
})
